-- @owner: @taoying
-- @date: 2025-09-17
-- @testpoint: objectproperty函数IsTableFunction测试表测试，合理报错
-- @modify: 

--step1:连接兼容D库创建数据库
@conn PrimaryDbDmode;
--step2:删除插件
create extension if not exists shark;
--step3:执行测试
DROP TABLE if exists user_log;
CREATE TABLE user_log (
id SERIAL PRIMARY KEY,
username VARCHAR(50),
email VARCHAR(100),
action_type VARCHAR(10),
action_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE OR REPLACE FUNCTION get_user_age(birth_date DATE)
RETURNS INT AS $$
BEGIN
RETURN (EXTRACT(YEAR FROM CURRENT_DATE) - EXTRACT(YEAR FROM birth_date))::INT;
END;
$$ LANGUAGE plpgsql;
/
select OBJECTPROPERTY (OBJECT_ID('get_user_age'), 'IsTableFunction');
select OBJECTPROPERTY (OBJECT_ID('get_user_age'), 'OwnerId');
select OBJECTPROPERTY (OBJECT_ID('user_log'), 'IsTableFunction');
select OBJECTPROPERTY (OBJECT_ID('user_log'), 'IsTrigger');
select OBJECTPROPERTY ('user_log', ' OwnerId');
select OBJECTPROPERTY ('', ' IsTableFunction');
select OBJECTPROPERTY ('IsTableFunction');
--step4:清理环境
drop TABLE if exists user_log;
drop FUNCTION if exists get_user_age;